package com.itheima.socket.tcp.demo14;

import com.itheima.socket.tcp.demo13.ClientHandler;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class ServerDemo14 {

    public static void main(String[] args) throws IOException {

        ExecutorService executorService = Executors.newFixedThreadPool(10);

        ServerSocket serverSocket = new ServerSocket(8282);

        while (true) {
            Socket socket = serverSocket.accept();

//            new Thread(new ClientHandler(socket)).start();
            executorService.submit(new ClientHandler(socket));

        }
    }
}
